﻿@using TjZheng.Test.DataEntity;
@inherits CMSWebViewPage<TemplateTest>
@{
    ViewBag.Title = "Template编辑页";
    Layout = "~/Views/Shared/_EditLayout.cshtml";
}
@section Head{
    @Html.CreateUpLoadSource()
    @Html.CreateEditorSource()
}
<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'center',border:false">
        <div class="top-block">
            @CurrentButtonTool.Create()
        </div>
        @*        <div class="top-block">
                <div id="toolbar_template" class="datagrid-toolbar top-tool">
                    <a onclick="Save();" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:true">保存</a>
                    <a onclick="Back();" class="easyui-linkbutton" data-options="iconCls:'icon-back',plain:true">返回</a>
                </div>
            </div>*@
        <form id="fr_template" method="post" enctype="multipart/form-data">
            @*@Html.AntiForgeryToken()*@
            <table class="tblContent">
                <colgroup>
                    <col class="colTitle">
                    <col class="colContent" />
                    <col class="colTitle" />
                    <col class="colContent" />
                </colgroup>
                <tr>
                    <td><span class="txtNoNull">*</span>TestString:</td>
                    <td>
                        @Html.Hidden("objProvide.Id", Model.Id, false)
                        @Html.StringBox("objProvide.TestString", Model.TestString, true, "请输入TestString", null, ValidType.Length(64), ValidType.Regex(ValidExpression.Email))
                        @*@Html.StringBox("objProvide.TestString", Model.TestString, true, 64, null, "email", "请输入TestString", null, null)*@
                    </td>
                    <td>TestBool:</td>
                    <td>
                        @Html.CheckBox("objProvide.TestBool", Model.TestBool, 1, 0)
                    </td>
                </tr>
                <tr>
                    <td><span class="txtNoNull">*</span>TesInt:</td>
                    <td>
                        @Html.ComboBox("objProvide.TesInt", Model.TesInt, true, "请选择TesInt", new List<SelectListItem>{
                        new SelectListItem{Text="测试1",Value="1"},
                        new SelectListItem{Text="测试2",Value="2"},
                        new SelectListItem{Text="测试3",Value="3"},
                        new SelectListItem{Text="测试4",Value="4"},
                        })
                    </td>
                    <td>TestDouble:</td>
                    <td>
                        @Html.NumberBox("objProvide.TestDouble", Model.TestDouble, null, 2)
                    </td>
                </tr>
                <tr>
                    <td><span class="txtNoNull">*</span>TestComboBoxRemote:</td>
                    <td>
                        @Html.ComboBox("objProvide.TestComboBoxRemote", Model.TestComboBoxRemote, true, "请选择TestComboBoxRemote", "/Template/TestListJson")
                    </td>
                    <td><span class="txtNoNull">*</span>TestCheckBoxListRemote:</td>
                    <td>
                        @Html.CheckBoxList("objProvide.TestCheckBoxListRemote", Model.TestCheckBoxListRemote, true, "/Template/TestListJson")
                    </td>
                </tr>
                <tr>
                    <td><span class="txtNoNull">*</span>TestRadioButtonListRemote:</td>
                    <td colspan="3">
                        @Html.RadioButtonList("objProvide.TestRadioButtonListRemote", Model.TestRadioButtonListRemote, true, "/Template/TestListJson")
                    </td>
                </tr>
                <tr>
                    <td>TestDate:</td>
                    <td>
                        @Html.DateTimeBox("objProvide.TestDate", Model.TestDate, null)
                    </td>
                    <td>TestImage:</td>
                    <td>
                        <ul class="single-row">
                            <li>@Html.UpLoadImage(1, "objProvide.TestImage", Model.TestImage)</li>
                            <li>@Html.CheckClearValue("清除配图", "objProvide.TestImage")</li>
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td>TestFile：</td>
                    <td colspan="3">
                        @Html.UpLoadNativeImage(1, "objProvide.TestFile", Model.TestFile)
                        @Html.CheckClearValue("清除配图", "objProvide.TestFile")
                    </td>
                </tr>
                <tr>
                    <td><span class="txtNoNull">*</span>TestCheckBoxList:</td>
                    <td>
                        @Html.CheckBoxList("objProvide.TestCheckBoxList", Model.TestCheckBoxList, true, new List<SelectListItem> {
                            new SelectListItem{Text="1",Value="1"},
                            new SelectListItem{Text="2",Value="2"},
                            new SelectListItem{Text="3",Value="3"},
                            new SelectListItem{Text="4",Value="4"},
                            new SelectListItem{Text="5",Value="5"}
                        })
                    </td>
                    <td><span class="txtNoNull">*</span>TestRadioList:</td>
                    <td>
                        @Html.RadioButtonList("objProvide.TestRadioList", Model.TestRadioList, true, new List<SelectListItem> {
                            new SelectListItem{Text="老板",Value="1"},
                            new SelectListItem{Text="领导",Value="2"},
                            new SelectListItem{Text="打杂",Value="3"}
                        })
                    </td>
                </tr>
                <tr>
                    <td>TestImages:</td>
                    <td colspan="3">
                        @Html.UpLoadImages(1, "objProvide.TestImages", Model.TestImages)
                    </td>
                </tr>
                <tr>
                    <td>TestArea:</td>
                    <td colspan="3">
                        @Html.TextArea("objProvide.TestArea", Model.TestArea, 5, 100, false, "请输入TestArea")
                    </td>
                </tr>
                <tr>
                    <td>TestContent:</td>
                    <td colspan="3">
                        @Html.Ueditor(2, 3, "objProvide.TestContent", Model.TestContent)
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <div class="image-preview" title="图片预览" data-options="region:'east',border:true">
        <div>
            <h1>TestImage</h1>
            @Html.ImagePreview("objProvide.TestImage", Model.TestImage)
        </div>
        <div>
            <h1>TestFile</h1>
            @Html.ImagePreview("objProvide.TestFile", Model.TestFile)
        </div>
    </div>
</div>
@section Bottom{
    <script type="text/javascript">
        function Save() {
            var objFormEntity = new FormEntity("#fr_template");
            objFormEntity.url = "/template/save/";
            objFormEntity.submitSuccess = function (InvokeResult) {
                if (InvokeResult.ResultCode == "Success") {
                    ShowMessage(InvokeResult.ResultMessage);
                    Back();
                } else {
                    ShowMessage(InvokeResult.ResultMessage);
                }
            };
            objFormEntity.isClearData = false;
            objFormEntity.submit();
        }
        function Back() {
            window.location.href = "/Template";
        }
    </script>
}
